#pragma once

#include <string>
#include <iostream>

#include "EventTypesFilter.h"
#include "ProcessNameFilter.h"
#include "AbpaFileFormat.h"

/**
 * This class actually processes APBA output
 * files, based on current filters.
 */
class FileProcessor
{
	EventTypesFilter &_etf;
	ProcessNameFilter &_pnf;
	bool _headersOnly;
	std::ostream &_os;

public:
	FileProcessor(EventTypesFilter &etf, ProcessNameFilter &pnf, bool headers_only, std::ostream &os)
		: _etf(etf), _pnf(pnf), _headersOnly(headers_only), _os(os)
	{}
	
	/**
	 * This is the function to do most of the work
	 * for this Whole program - it takes a single filename,
	 * and performs all required processing of the output file
	 */
	void process(std::string name);

private:
	// helpers
	void printHeader(events::AbpaFileFormat &header, string &name);
	void printEOFInfo(events::AbpaFileFormat &header, istream &in);
	void dumpAllEvents(events::AbpaFileFormat &header, istream &in);

};
